package com.github.catvod.utils;

// 终端命令
public class Shell {

    public static void exec(String command) {
        try {
            // 进行检查系统类型
            String osName = System.getProperty("os.name").toLowerCase();
            if (osName.contains("win")) {
                // Windows 系统，不执行 chmod 命令
                return;
            }
            int code = Runtime.getRuntime().exec(command).waitFor();
            if (code != 0) throw new RuntimeException("Shell command failed with exit code " + code);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}